import React, {
	PureComponent
} from 'react';
import { connect } from 'dva';
import moment from 'moment';
import { Row, Col, Card, Form, Input,List, Select, Icon, Button, Dropdown, Menu, InputNumber, DatePicker, Modal, TreeSelect, Tree, message, Badge, Divider, Upload, Radio, label, Table, Popconfirm } from 'antd';
import StandardTable from '../../components/StandardTable';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import styles from '../Mana/Role.less';
import { getusername } from '../../utils/utils';

//默认状态
var state;

/*角色*/
const { MonthPicker, RangePicker } = DatePicker;
const dateFormat = 'YYYY-MM-DD';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const { Option } = Select;
const TreeNode = Tree.TreeNode;
const confirm = Modal.confirm;
const {
	TextArea
} = Input;
const getValue = obj => Object.keys(obj).map(key => obj[key]).join(',');


//查询出的数据信息
var classrooms = [];
var curData =[];
var curData1 =[];
var weekDay="";
var chooseTimes=[];
var newTimes=[];
var classes=[];
var defaultTimes=[];
var curClss;
var expectTimes=[];
var flag=false;
const columns2 = [{
	title: '课程名字',
	dataIndex: 'course',
	key: 'course',
}, {
	title: '课程进度',
	dataIndex: 'flag',
	key: 'flag',
	render: (text, record, index) => {
		if(record.flag == 0) {
			return (<p style={{'color':'green'}}>待开课</p>)
		} else if(record.flag == 1) {
			return (<p style={{'color':'blue'}}>已开课</p>)
		}
		else if(record.flag == 2) {
			return (<p style={{'color':'red'}}>未开课</p>)
		}
	}
}];
const columns3 = [{
		title: '',
		dataIndex: 'time',
		key: 'time',
	}];
	/* 期望时间 */
	const columns4 = [
		{
			title: '孩子名字',
			dataIndex: 'childrenName',
			key: 'childrenName',
			width:'20%'
		},
		{
			title: '期望时间',
			dataIndex: 'expectedTimes',
			key: 'expectedTimes',
		},
		];
//table复选框选中
// rowSelection objects indicates the need for row selection
var rowSelections2 = "";
const rowSelection2 = {
	getCheckboxProps(record) {
		return {
			defaultChecked: record.isRole == 1, // 配置默认勾选的列
		};
	},
	onSelect: (record, selected, selectedRows) => {
		rowSelections2 = new Object(); //声明对象
		rowSelections2.selected = selected;
		rowSelections2.selectedRows = selectedRows;
	},
	onSelectAll: (selected, selectedRows, changeRows) => {
		rowSelections2 = new Object(); //声明对象
		rowSelections2.selected = selected;
		rowSelections2.selectedRows = selectedRows;
	},
};
const CreateForm = Form.create()(props => {
	const {
		modalVisible,
		form,
		handleAdd,
		handleModalVisible,
		title,
		obj,
		getData,
		queryTimesByClassAndTime,
		chooseTime,
		getClassroomField
	} = props;
	const {
		getFieldDecorator
	} = form;
	const okHandle = () => {
		if(title == "新建" || title == "编辑") {
			form.validateFields((err, fieldsValue) => {
				if(err) return;
				if(fieldsValue.state == undefined) {
					fieldsValue.state = 1
				};
				if(fieldsValue.description == undefined) {
					fieldsValue.description = ""
				};
				handleAdd(title, obj.roleId, fieldsValue);
			});
		} else {
			form.validateFields((err, fieldsValue) => {
				handleAdd(title, obj.roleId, fieldsValue);
			});
		}
	};
	const queryTimes = () => {
		
			form.validateFields((err, fieldsValue) => {
				queryTimesByClassAndTime(fieldsValue);
			});
	};
	if(title == "编辑班级信息") {
		return(
			<Modal
			maskClosable={false}
			destroyOnClose={true}
			width={'60%'}
			title={title}
			visible={modalVisible}
			onOk={okHandle}
			onCancel={() => handleModalVisible(false,'','')}
		>
			<Form layout="horizontal">
						<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
								<Col md={8} sm={24}>
									<FormItem label="班级人数：">
										{getFieldDecorator('classNumber')(<p>{obj.classNumber}</p>)}
									</FormItem>
								</Col>
								<Col md={8} sm={24}>
									<FormItem label="绑定课程包：">
											{getFieldDecorator('coursePackageName')(<p>{obj.coursePackageName}</p>)}
									</FormItem>
						</Col>
						</Row>
						<FormItem label="绑定教室：">
							{getFieldDecorator('classroomName',{
								initialValue:obj.classroomName==undefined ? "":obj.classroomName,
							})(<Select placeholder="请选择" onChange={getClassroomField}>
									{classes}
								</Select>)}
						</FormItem>
						<FormItem label="班级名称：">
							{getFieldDecorator('className',{
								initialValue:obj.className==undefined ? "":obj.className,
							})(<Input placeholder="请输入" />)}
						</FormItem>
						<FormItem label="班级编号：">
							{getFieldDecorator('classCode',{
								initialValue:obj.classCode==undefined ? "":obj.classCode,
							})(<Input placeholder="请输入" />)}
						</FormItem>
		</Form>
		</Modal>
		);
	} else if(title == "手动排课") {
		return(
			<Modal
      maskClosable={false}
      destroyOnClose={true}
      width={'60%'}
      title={title}
      visible={modalVisible}
      onOk={okHandle}
      onCancel={() => handleModalVisible(false,'','')}
	>
			<Form layout="horizontal" onSubmit={queryTimes}>
						<Row gutter={{ md: 6, lg: 24, xl: 48 }} type="flex" justify="space-around" align="middle">
								<Col md={6} sm={24}>
									<FormItem label="教室">
											{getFieldDecorator('classroom', {
												initialValue:obj.classroomId+','+obj.classroomName,
											})(<Select placeholder="请选择">
													{classrooms}
											</Select>)}
									</FormItem>
								</Col>
								<Col md={6} sm={24}>
									<FormItem label="选择日期：">
											{getFieldDecorator('date')(<DatePicker onChange={getData} format={dateFormat}/>)}
									</FormItem>
								</Col>
								<Col md={6} sm={24}>
									<FormItem label="周：">
											{getFieldDecorator('week',{
												initialValue:weekDay,
											})(<Input placeholder="请输入"/>)}
									</FormItem>
								</Col>
								<Col md={6} sm={24}>
									<FormItem>
											<Button htmlType="submit">查看时间</Button>
									</FormItem>
								</Col>
						</Row>
						
		</Form>
		<List
			grid={{ gutter: 16, column: 4 }}
			dataSource={defaultTimes}
			renderItem={item => (
					<List.Item>
						<Card style={{'textAlign':'center','padding':'0','position':'relative'}} onClick={chooseTime}>
						<p style={item.className==""||item.className==null?{'width':'100%','height':'50px','backgroundColor':'','margin':'0px','padding':'0','position':'absolute','lineHeight':'50px','marginLeft':'-24px','marginTop':'-24px',}:{'width':'100%','height':'50px','backgroundColor':'#fb909a','margin':'0px','padding':'0','position':'absolute','lineHeight':'50px','marginLeft':'-24px','marginTop':'-24px','color':'#fff'}}>{item.className==""||item.className==null?item.time+"(暂无安排)":item.time+"(  "+item.classType+"  )"}</p>
						</Card>
					</List.Item>	
			)}
		/>
		<h2>参考:期望时间及课程进度</h2>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
				<Col md={12} sm={24}>
					<Table
						dataSource={curData}
						columns={columns4}
					/>
				</Col>
				<Col md={12} sm={24}>
					<Table
						dataSource={curData1}
						columns={columns2}
					/>
		</Col>
		</Row>
    </Modal>
		)
	} else{
		
			return(
				<Modal
				maskClosable={false}
				destroyOnClose={true}
				width={'60%'}
				title={title}
				visible={modalVisible}
				onOk={okHandle}
				onCancel={() => handleModalVisible(false,'','')}
		>
				<Table
					dataSource={curData}
					columns={columns2}
				/>
			</Modal>
			)
	}
});



@connect(({ classMann, loading }) => ({
	classMann,
	loading: loading.models.classMann,
}))

@Form.create()
export default class TableList extends PureComponent {
	state = {
		modalVisible: false,
		expandForm: false,
		selectedRows: [],
		formValues: {},
		obj: "",
	};

	componentDidMount() {
		const { dispatch } = this.props;
		/*获取list*/
		dispatch({
			type: 'classMann/queryList',
			payload: {
			},
		});
		/* 查询所有的教室 */
		dispatch({
			type: 'classMann/queryClassroom',
			payload: {
				
			},
			callback:function(res,data){
				classrooms = [];
				if(res == 1) {
					for(let i = 0; i < data.length; i++) {
						classrooms.push(<Option key={data[i].classroomId+","+data[i].name }>{data[i].name }</Option>);
					}
				}
			}
		});
	}
	/*获取当前班级信息*/
	getClassroomField=(e)=>{
		flag=true;
		curClss=e;
	}
	handleStandardTableChange = (pagination, filtersArg, sorter) => {
		const {
			dispatch
		} = this.props;
		const {
			formValues
		} = this.state;
		const filters = Object.keys(filtersArg).reduce((obj, key) => {
			const newObj = { ...obj
			};
			newObj[key] = getValue(filtersArg[key]);
			return newObj;
		}, {});
		const params = {
			currentPage: pagination.current,
			pageSize: pagination.pageSize,
			...formValues,
			...filters,
		};
		if(sorter.field) {
			params.sorter = `${sorter.field}_${sorter.order}`;
		}
		dispatch({
			type: 'classMann/queryList',
			payload: params,
		});
	};
	/* 选择上课期望时间 */
	chooseTime = (e) => {
			var target=e.target;
			chooseTimes=[];
			console.log(target.style.backgroundColor)
			/* 还未选择状态 */
			if(target.style.backgroundColor==''&&target.style.color==""){
				var list=document.getElementsByClassName('ant-card-body');
				for(var i=0;i<list.length;i++){
					list[i].style.backgroundColor='';
				}
				if(target.parentNode.className==='ant-card-body'){
						target.parentNode.style.backgroundColor='#e8e8e8';
						chooseTimes.push(target.innerText.split('(')[0]);
				}else{

				}
				
			}
			/* 已被选择状态，再次点击，将被取消选中状态 */
			else if(target.parentNode.style.backgroundColor='==#e8e8e8'){
				var list=document.getElementsByClassName('ant-card-body');
				for(var i=0;i<list.length;i++){
					list[i].style.backgroundColor='';
				}
				chooseTimes=[];
			}
			/* 该时间端被占用，禁止选中状态时，点击将无效果 */
			else if(target.parentNode.style.backgroundColor=="rgb(251, 98, 116)"||target.parentNode.style.color=="rgb(255, 255, 255)"){
				var list=document.getElementsByClassName('ant-card-body');
				for(var i=0;i<list.length;i++){
					list[i].style.backgroundColor='';
				}
				if(target.parentNode.className==='ant-card-body'){
					target.parentNode.style.backgroundColor=="rgb(251, 98, 116)";
					chooseTimes=[];
				}
				
			}
			console.log(chooseTimes)
	}
/* 得到当前选择的日期 */
	getData = (e) =>{
		var weekText=e._d.toString().substring(0,3);
		switch(weekText){
			case 'Mon':
				weekDay='一';
			break;
			case 'Tue':
				weekDay='二';
			break;
			case 'Wed':
				weekDay='三';
			break;
			case 'Thu':
				weekDay='四';
			break;
			case 'Fri':
				weekDay='五';
			break;
			case 'Sat':
				weekDay='六';
			break;
			case 'Sun':
				weekDay='日';
			break;
		}
	}
	handleStandardTableChange = (pagination, filtersArg, sorter) => {
		const {
			dispatch
		} = this.props;
		const {
			formValues
		} = this.state;
		const filters = Object.keys(filtersArg).reduce((obj, key) => {
			const newObj = { ...obj
			};
			newObj[key] = getValue(filtersArg[key]);
			return newObj;
		}, {});
		const params = {
			currentPage: pagination.current,
			pageSize: pagination.pageSize,
			...formValues,
			...filters,
		};
		if(sorter.field) {
			params.sorter = `${sorter.field}_${sorter.order}`;
		}
		dispatch({
			type: 'classMann/queryList',
			payload: params,
		});
	};
	handleSelectRows = rows => {
		this.setState({
			selectedRows: rows,
		});
	};
	queryTimesByClassAndTime = (fields) =>{
		var month;
		if(parseInt(fields.date._d.getMonth()+1)<10){
			month="0"+parseInt(fields.date._d.getMonth()+1);
		}else{
			month=parseInt(fields.date._d.getMonth()+1);
		}
		var date=fields.date._d.getFullYear()+"-"+month+"-"+fields.date._d.getDate();
		var dataJson={
			classroomId:fields.classroom.split(',')[0],
			time:date,
			week:fields.week
		}
		this.props.dispatch({
			type: 'classMann/queryTimeByClassAndTime',
			payload: dataJson,
			callback: (res, data) => {
				if(res == 1) {
					newTimes=[];
					defaultTimes=[];
					for(var i=0;i<data.length;i++){
						if(data[i].classType==null||data[i].classType==""){
							newTimes.push({time:data[i].employTime,classType:"",className:""});
						}
						else{
							newTimes.push({time:data[i].employTime,classType:data[i].className,className:data[i].className});
						}
					}
					defaultTimes=newTimes;
					console.log(newTimes)
				} else {
					
				}
			},
		});
	}
	handleSearch = e => {
		e.preventDefault();
		const {
			dispatch,
			form
		} = this.props;
		form.validateFields((err, fieldsValue) => {
			if(err) return;
			const values = { ...fieldsValue,
			};
			this.setState({
				formValues: values,
			});
			if(values.name == undefined) values.name = ""
			if(values.description == undefined) values.description = ""
			if(values.state == undefined) values.state = ""
			if(values.updatedAt == undefined) values.updatedAt = ""
			dispatch({
				type: 'classMann/queryList',
				payload: { ...values
				}
			});
		});
	};
	handleFormReset = () => {
		const {
			form,
			dispatch
		} = this.props;
		form.resetFields();
		this.setState({
			formValues: {},
		});
		dispatch({
			type: 'classMann/queryList',
		});
	}
	/*弹窗 */
	handleModalVisible = (flag, record, title) => {
		var obj = "";
		const {
			dispatch,
			form
		} = this.props;
		/*关闭弹窗-取消-colse*/
		if(flag == false) {
			this.setState({
				modalVisible: flag,
				title: title,
				obj: obj,
			});
			defaultTimes=[];
		} else {
			/*操作关闭*/
			if(title == "新建") {
				this.setState({
					modalVisible: flag,
					title: title,
					obj: obj,
				});
			} else {
				const { selectedRows } = this.state;
				if((record == undefined || Object.keys(record).length == 0) && Object.keys(selectedRows).length == 0) {
					message.info("还未选择项");
				} else if(Object.keys(selectedRows).length > 1) {
					message.info("只能选择一项进行操作");
				} else {
					var Ids = [];
					if(record != undefined && Object.keys(record).length > 0) {
						Ids = record;
					} else if(selectedRows != null) {
						Ids.push(selectedRows.map(row => row.roleId).join(','));
					}
					if(title=='编辑班级信息'){
						this.setState({
							modalVisible: flag,
							title: title,
							obj: selectedRows[0],
						});
						/* 根据所选小孩筛选出班级列表 */
							dispatch({
								type: 'classMann/queryClassrommByPackage',
								payload: {
									coursePageId:selectedRows[0].coursePackageId,
								},
								callback: (res, data) => {
									classes = [];
									if(res == 1) {
										for(let i = 0; i < data.length; i++) {
											classes.push(<Option key={data[i].classroomId+","+data[i].name}>{data[i].name}</Option>);
										}
									}else{
										
									}
								}
							});
					}
					else if(title == "手动排课") {
						if(selectedRows[0].state==1){
							message.info('您已经排课完成，无需重复操作！');
						}else{
								this.setState({
									modalVisible: flag,
									title: title,
									obj:selectedRows[0]
								});
								this.props.dispatch({
									type: 'classMann/queryExpectTime',
									payload: {
										classId:selectedRows[0].classId,
									},
									callback: (res, data) => {
										if(res == 1) {
											curData=data;
										} else {
											
										}
									},
								});
								this.props.dispatch({
									type: 'classMann/queryClassSchedule',
									payload: {
										classId:selectedRows[0].classId,
										coursePackageId:selectedRows[0].coursePackageId
									},
									callback: (res, data) => {
										if(res == 1) {
											curData1=data;
										} else {
											
										}
									},
								});
						}
					}
					else if(title=='课程进度'){
						this.setState({
							modalVisible: flag,
							title: title,
							obj: selectedRows[0],
						});
						this.props.dispatch({
							type: 'classMann/queryClassSchedule',
							payload: {
								classId:record.classId,
								coursePackageId:record.coursePackageId
							},
							callback: (res, data) => {
								if(res == 1) {
									curData=data;
								} else {
									
								}
							},
						});
					}
					else if(title=='取消排课'){
						record=selectedRows[0];
						if(record.state==0){
							message.info('您还未学习任何课程！');
						}else if(record.state==1){
						confirm({
							title: '确认要取消排课?',
							content: '取消后将无法再学习该课程',
							okText: '是',
							okType: 'danger',
							cancelText: '否',
							onOk() {
									dispatch({
										type: 'classMann/replaceClass',
										payload: {
											state:1,
											classId:record.classId,
											classroomId:record.classroomId
										},
										callback: (res, resMsg) => {
											if(res == 1) {
												message.success(resMsg);
												dispatch({
													type: 'classMann/queryList',
													payload: {
													},
												});
											} else {
												message.error(resMsg);
											}
										},
									});
							},
							onCancel() {
								console.log('Cancel');
							},
						});
						}
					}
					
				}
			}
		}
	};
	/*编辑，绑定*/
	handleAdd = (title, Id, fields) => {
		const {
			selectedRows
		} = this.state;
		if(title == "手动排课") {
			/* 提交 排课 */
			var month;
			if(parseInt(fields.date._d.getMonth()+1)<10){
				month="0"+parseInt(fields.date._d.getMonth()+1);
			}else{
				month=parseInt(fields.date._d.getMonth()+1);
			}
			var day;
			if(parseInt(fields.date._d.getDate()+1)<10){
				day="0"+parseInt(fields.date._d.getDate()+1);
			}else{
				day=parseInt(fields.date._d.getDate()+1);
			}
			var date=fields.date._d.getFullYear()+"-"+month+"-"+day+"/"+chooseTimes[0];
			var dateJson={ 
					state:0,
					employNum:selectedRows[0].classNumber,
					time:date,
					classId:selectedRows[0].classId,
					classroomName:fields.classroom.split(',')[1],
					classroomId:fields.classroom.split(',')[0],
					courseBackageId:selectedRows[0].coursePackageId,
					courseBackageName:selectedRows[0].coursePackageName
				}
				if(chooseTimes.length==0){
					message.error('您还未选课程时间');
				}else{
					this.props.dispatch({
					type: 'classMann/replaceClass',
					payload: dateJson,
					callback: (res, resMsg) => {
						if(res == 1) {
							message.success(resMsg);
							this.props.dispatch({
								type: 'classMann/queryList',
								payload: {
								},
							});
							this.setState({
								modalVisible: false,
							});
							chooseTimes=[];
							defaultTimes=[];
						} else {
							message.error(resMsg);
						}
					},
				});
				}
			}else if(title=='编辑班级信息'){
			var dataJson={};
			if(flag){
				dataJson={
				classCode:fields.classCode,
				className:fields.className,
				classroomName:curClss.split(',')[1],
				classroomId:selectedRows[0].classroomId,
				classId:selectedRows[0].classId
				}
			}else{
				dataJson={
				classCode:fields.classCode,
				className:fields.className,
				classroomName:fields.classroomName,
				classroomId:selectedRows[0].classroomId,
				classId:selectedRows[0].classId
				}
			}
			this.props.dispatch({
				type: 'classMann/updateClassForm',
				payload:dataJson,
				callback: (res, resMsg) => {
					if(res == 1) {
						message.success(resMsg);
						this.props.dispatch({
							type: 'classMann/queryList',
							payload: {
							},
						});
						this.setState({
							modalVisible: false,
						});
					} else {
						message.error(resMsg);
					}
				},
			});
		} 
	};

	/*删除*/
	confirmModel = (title, Id) => {
		const { dispatch } = this.props;
		const { selectedRows } = this.state;
		if(Id == undefined && Object.keys(selectedRows).length == 0) {
			message.info("还未选择项");
		} else {
			var Ids = [];
			/*获取选中的用户名字*/
			var name =[];
			if(Id != undefined) {
				Ids = Id;
				name = Id;
			} else if(selectedRows != null) {
				Ids.push(selectedRows.map(row => row.roleId).join(','));
				name.push(selectedRows.map(row => row.name).join(','));
			}
			for(var i=0;i<name.length;i++){
				if(name[i] == getusername()){
					console.log("不能对自己进行操作");
				}
			}
			
			
			if(title == "删除") {
				Modal.confirm({
					title: '是否删除当前选中数据',
					content: '',
					onOk() {
						dispatch({
							type: 'manarole/remove_role',
							payload: {
								roleIds: Ids,
							},
							callback: (res, resMsg) => {
								if(res == 1) {
									message.success(resMsg);
								} else {
									message.error(resMsg);
								}
							},
						});
					},
				});
			} else if(title == "启用" || title == "禁用") {
				var state;
				if(title == "启用") {
					state = 1;
				} else {
					state = 0;
				}
				Modal.confirm({
					title: '是否' + title + '当前数据选中',
					onOk() {
						dispatch({
							type: 'manarole/edit_role_state',
							payload: {
								roleIds: Ids,
								state: state,
							},
							callback: (res, resMsg) => {
								if(res == 1) {
									message.success(resMsg);
								} else {
									message.error(resMsg);
								}
							},
						});
					},
				});
			}

		}
	}

	renderSimpleForm() {
		const {
			getFieldDecorator
		} = this.props.form;
		return "";
		return(
			<Form onSubmit={this.handleSearch} layout="inline">
			<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
				<Col md={8} sm={24}>
					<FormItem label="班级：">
						{getFieldDecorator('class')(<Select placeholder="请选择">
																					<Option value="1">教室1</Option>
																					<Option value="0">教室2</Option>
																			</Select>)}
					</FormItem>
				</Col>
				<Col md={8} sm={24}>
					<FormItem label="绑定教室：">
							{getFieldDecorator('classroom')(<Select placeholder="请选择">
																										<Option value="1">教室1</Option>
																										<Option value="0">教室2</Option>
																								</Select>)}
					</FormItem>
				</Col>
        	<Col md={8} sm={24}>
           	<span className={styles.submitButtons} style={{ float: 'right'}}>
              <Button type="primary" htmlType="submit">查询</Button>
              <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>重置</Button>
            </span>
          </Col>
        </Row>
      </Form>
		);
	}
	renderForm() {
		return this.state.expandForm = this.renderSimpleForm();
	}

	render() {
		const { classMann: { data }, loading } = this.props;
		const {
			selectedRows,
			modalVisible,
			title,
			obj
		} = this.state;
		/*const rowKey = function(record) {
		  return record.roleId;  //主键id
		};*/
		const columns = [
			{
			title: '班级名称',
			dataIndex: 'className',
			key: 'className',
			width: '15%',
		},
		{
			title: '班级编号',
			dataIndex: 'classCode',
			key: 'classCode',
			width: '10%',
		},
		{
			title: '教室',
			dataIndex: 'classroomName',
			key: 'classroomName',
			width: '10%',
		},
		{
			title: '上课内容',
			dataIndex: 'coursePackageName',
			key: 'coursePackageName',
			width: '20%',
		},
		{
			title: '在课人数',
			dataIndex: 'classNumber',
			key: 'classNumber',
			width: '10%',
		},
		{
			title: '是否可排班',
			dataIndex: 'state',
			key: 'state',
			width: '10%',
			render: (text, record, index) => {
				if(record.state == 0) {
					return "是"
				} else if(record.state == 1) {
					return "否"
				}
			}
		},
		{
			title: '最后上课时间',
			dataIndex: 'endAttendClass',
			key: 'endAttendClass',
			width: '15%',
		},
		{
			title: '班级进度',
			fixed: 'right',
			render: (text, record, index) => {
				return (
				<div>
					<Button type="primary" size={'small'} onClick={() => this.handleModalVisible(true,record,'课程进度')}>进度</Button>
				</div>
				)
			}
		},];
		const parentMethods = {
			handleAdd: this.handleAdd,
			handleModalVisible: this.handleModalVisible,
			confirmModel: this.confirmModel,
			getData:this.getData,
			queryTimesByClassAndTime:this.queryTimesByClassAndTime,
			chooseTime:this.chooseTime,
			getClassroomField:this.getClassroomField
		};
		return(
			<PageHeaderLayout title="课程系统/班级管理">
      	<Card bordered={false}>
          <div className={styles.tableList}>
            <div className={styles.tableListForm}>{this.renderForm()}</div>
            <div className={styles.submitButtons}>
            	<Button type="primary"  onClick={() => this.handleModalVisible(true,'','编辑班级信息')}>编辑班级信息</Button>
            	<Button type="primary"  onClick={() => this.handleModalVisible(true,'','手动排课')}>手动排课</Button>
							<Button  type="ghost"   onClick={() => this.handleModalVisible(true,'','取消排课')}>取消排课</Button>
		      	
            </div>
            <StandardTable
              selectedRows={selectedRows}
              loading={loading}
              data={data}
              columns={columns}
              onSelectRow={this.handleSelectRows}
              onChange={this.handleStandardTableChange}
            />
          </div>
        <CreateForm {...parentMethods} modalVisible={modalVisible} title={title} obj={obj}/>
      </Card>
      </PageHeaderLayout>
		);
	}
}